package com.kf.util;

import org.apache.shiro.crypto.hash.SimpleHash;
import org.apache.shiro.util.ByteSource;

import java.util.UUID;

/**
 * md5跑龙套
 *
 * @author Honey
 * @date 2022/12/23
 */
public class MD5Utils {
    public static  String SALT = "dishiyizu";

    private static final String ALGORITH_NAME = "md5";

    private static final int HASH_ITERATIONS = 2;

    public static String encrypt(String username, String pswd) {
        return new SimpleHash(ALGORITH_NAME, pswd, ByteSource.Util.bytes(username + SALT),
                HASH_ITERATIONS).toHex();

    }
    public static String MD5Encode(){

        return UUID.randomUUID().toString()+System.currentTimeMillis();
    }

    public static void main(String[] args) {
        System.out.println(MD5Utils.encrypt("2020110223", "123456"));
//        System.out.println(MD5Utils.encrypt("123456"));

//        System.out.println(admin);
//        SimpleHash simpleHash = new SimpleHash();
//        simpleHash.
    }

}
